<style>
</style>
<template>
  <div>
    <Form :model="majorcourse" :label-width="90" label-position="left">
      <Row>
        <Col span="12">
          <FormItem label="课程">
            <Select v-model="majorcourse.csId" filterable style="width: 90%;float: left;">
              <Option
                v-for="item in csIdList"
                :value="item.csId"
                :key="item.csId"
                :label="item.csId"
              >
                <span>{{item.csId}}</span>
                <span style="float:right;color:#808695">{{item.csName}}</span>
              </Option>
            </Select>
          </FormItem>
        </Col>
        <Col span="12">
          <FormItem label="课程性质">
            <Select v-model="majorcourse.csProperties" filterable style="width: 90%;float: left;">
              <Option value="公共基础">公共基础</Option>
              <Option value="专业核心">专业核心</Option>
              <Option value="专业选考">专业选考</Option>
            </Select>
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col span="12">
          <FormItem label="课程类别">
            <Select v-model="majorcourse.mcType" filterable style="width: 90%;float: left;">
              <Option value="必考">必考</Option>
              <Option value="选考">选考</Option>
            </Select>
          </FormItem>
        </Col>
        <Col span="12">
          <FormItem label="考核方式">
            <Select v-model="majorcourse.mcAssmethod" filterable style="width: 90%;float: left;">
              <Option value="笔试">笔试</Option>
              <Option value="非笔试">非笔试</Option>
              <Option value="机考">机考</Option>
            </Select>
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col span="12">
          <FormItem label="考试类型">
            <Select v-model="majorcourse.examType" style="width: 90%;float: left;">
              <Option value="统考">统考</Option>
              <Option value="省考">省考</Option>
            </Select>
          </FormItem>
        </Col>
        <Col span="12">
          <FormItem label="所属方向">
            <Select v-model="majorcourse.mrId" filterable style="width: 90%;float: left;">
              <Option
                v-for="item in mrIdList"
                :value="item.mrId"
                :key="item.mrId"
                :label="item.mrId"
              >
                <span>{{item.mrId}}</span>
                <span style="float:right;color:#808695">{{item.oriName}}</span>
              </Option>
            </Select>
          </FormItem>
        </Col>
      </Row>
      <Row>
        <Col span="12">
          <FormItem label="备注">
            <Input v-model="majorcourse.mcRemark" style="width: 90%;float: left;" type="text" />
          </FormItem>
        </Col>
      </Row>
    </Form>
  </div>
</template>

<script>
export default {
  props: ["majorId"],
  data() {
    return {
      majorcourse: {},
      mrIdList: [],
      csIdList: []
    };
  },
  created() {
    this.$axios
      .get(
        this.$host +
          "/MajorOrientation/majorOrientationByMajor?mjId=" +
          this.majorId
      )
      .then(res => {
        this.mrIdList = res.data.data;
      });
    this.$axios
      .get(this.$host + "/course/management/allCourses?pageNum=1&pageSize=9999")
      .then(res => {
        this.csIdList = res.data.data.list;
      });
  },
  watch: {
    majorcourse: {
      handler() {
        this.trans();
      },
      deep: true
    }
  },
  methods: {
    trans() {
      this.$emit("getMajorCourse", this.majorcourse);
    }
  }
};
</script>